<?php

class JS_Token {
	
	private $_kind;
	private $_value;
	private $_next;
	private $_prev;
	
	public function __construct($kind,$value) {
		$this->_kind = $kind;
		$this->_value = $value;
		$this->_next = null;
		$this->_prev = null; 
	}
	
	public function getKind($kind=null) {	
		return $kind ? $kind == $this->_kind : $this->_kind; 
	}
	
	public function getValue() { return $this->_value; }
	public function getNext() {	return $this->_next; }
	public function getPrev() { return $this->_prev; }
	
	public function setNext(&$next=null) {	
		$this->_next = $next;
		if ($next) $next->setPrev($this);
	}
	public function setPrev(&$prev=null) { $this->_prev = $prev; }
	
	public function __toString() {
		return $this->_kind . ': ' . $this->_value;
	}
	
}

?>